import { h } from 'vue'
import { NIcon } from 'naive-ui'
import { 
  BulbOutline, 
  BuildOutline, 
  ListOutline, 
  DocumentTextOutline, 
  PeopleOutline,
  DocumentsOutline,
  IdCardOutline,
  NewspaperOutline
} from '@vicons/ionicons5'

// 菜单项接口定义
export interface BookMenuItem {
  label: string
  key: string
  icon: () => any
  disabled?: boolean
}

// 书籍工作区菜单项配置
export const bookWorkspaceMenuItems: BookMenuItem[] = [
  {
    label: '大纲',
    key: 'outline',
    icon: () => h(NIcon, null, { default: () => h(NewspaperOutline) })
  },
  {
    label: '人设',
    key: 'characters',
    icon: () => h(NIcon, null, { default: () => h(PeopleOutline) })
  },
  {
    label: '其他设定',
    key: 'settings',
    icon: () => h(NIcon, null, { default: () => h(BuildOutline) })
  },
  {
    label: '章节',
    key: 'chapters',
    icon: () => h(NIcon, null, { default: () => h(DocumentTextOutline) })
  },
  {
    label: '灵感',
    key: 'inspirations',
    icon: () => h(NIcon, null, { default: () => h(BulbOutline) })
  }
]

// 应用侧边栏菜单项配置（用于AppLayout）
export const appSidebarMenuItems: BookMenuItem[] = [
    {
    label: '章节',
    key: '/chapters',
    icon: () => h(NIcon, null, { default: () => h(DocumentsOutline) })
  },
  {
    label: '大纲',
    key: '/books/workspace/:id/outline',
    icon: () => h(NIcon, null, { default: () => h(ListOutline) })
  },
  {
    label: '人设',
    key: '/books/workspace/:id/characters',
    icon: () => h(NIcon, null, { default: () => h(IdCardOutline) })
  },
  {
    label: '其他设定',
    key: '/settings',
    icon: () => h(NIcon, null, { default: () => h(BuildOutline) })
  },
  {
    label: '灵感',
    key: '/inspirations',
    icon: () => h(NIcon, null, { default: () => h(BulbOutline) })
  }
]

// 获取书籍工作区菜单选项（带禁用状态）
export function getBookWorkspaceMenuOptions(hasCurrentBook: boolean): BookMenuItem[] {
  return bookWorkspaceMenuItems.map(item => ({
    ...item,
    disabled: !hasCurrentBook
  }))
}

// 获取应用侧边栏菜单选项（带禁用状态）
export function getAppSidebarMenuOptions(hasCurrentBook: boolean): BookMenuItem[] {
  return appSidebarMenuItems.map(item => ({
    ...item,
    disabled: !hasCurrentBook
  }))
}